home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: embedded strtok() calls on different strings?
- Date: 08 Feb 1996 23:56:05 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Feb8165605@qcd.lanl.gov>
- References: <DMGrn7.1Bx0@CompStar.bnr.ca>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: tzinck@bnr.ca's message of Thu, 8 Feb 1996 15:42:43 GMT
-
- In article <DMGrn7.1Bx0@CompStar.bnr.ca> tzinck@bnr.ca writes:
- <snip>
- char *string1="This is string one";
- char *string2="This is string two";
-
- void *vp1;
- void *vp2;
-
- vp1 = strtok(string1," ");
-
- This line tries to modify a string literal: this invokes undefined
- behaviour. Anything could happen, including the program crashing right
- away. You observe a different behaviour: but that is precisely what
- `undefined behaviour' means.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-